﻿namespace Vdc.Interface
{
    using System;
    using System.ComponentModel;
    using System.Text;

    public class VdcRadioButtonClientSideEvents : VdcPersistentObject
    {
        internal virtual string SerializeToJSON()
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("{");
            bool flag = false;
            if (!string.IsNullOrEmpty(this.OnCheckedChanged))
            {
                builder.Append("'OnCheckedChanged': " + this.OnCheckedChanged);
                flag = true;
            }
            if (!string.IsNullOrEmpty(this.OnClick))
            {
                if (flag)
                {
                    builder.Append(",");
                }
                builder.Append("'OnClick': " + this.OnClick);
                flag = true;
            }
            if (!string.IsNullOrEmpty(this.OnFocus))
            {
                if (flag)
                {
                    builder.Append(",");
                }
                builder.Append("'OnFocus': " + this.OnFocus);
                flag = true;
            }
            if (!string.IsNullOrEmpty(this.OnBlur))
            {
                if (flag)
                {
                    builder.Append(",");
                }
                builder.Append("'OnBlur': " + this.OnBlur);
            }
            builder.Append("}");
            return builder.ToString();
        }

        [DefaultValue(""), Description("Client-side function to be executed when the radio button loses the focus."), Bindable(true), Category("Client-Side Events")]
        public string OnBlur
        {
            get
            {
                object obj2 = this.ViewState["OnBlur"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnBlur"] = value;
            }
        }

        [Description("Client-side function to be executed when the checked state of the radio button is changed."), Category("Client-Side Events"), Bindable(true), DefaultValue("")]
        public string OnCheckedChanged
        {
            get
            {
                object obj2 = this.ViewState["OnCheckedChanged"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnCheckedChanged"] = value;
            }
        }

        [Category("Client-Side Events"), DefaultValue(""), Description("Client-side function to be executed when the radio button is clicked."), Bindable(true)]
        public string OnClick
        {
            get
            {
                object obj2 = this.ViewState["OnClick"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnClick"] = value;
            }
        }

        [Description("Client-side function to be executed when the radio button is focused."), Bindable(true), DefaultValue(""), Category("Client-Side Events")]
        public string OnFocus
        {
            get
            {
                object obj2 = this.ViewState["OnFocus"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnFocus"] = value;
            }
        }
    }
}

